package api

import (
	"gitee.com/lilihli/connector/api/cjzq"
	"gitee.com/lilihli/connector/api/htwt"
)

// Operator 证券客户端操作接口
type Operator interface {
	ConnectClient() error
	BuyMoney(account string, ticker string, money float64) (int, float64, error)
	BuyNumber(account string, ticker string, number uint64) (float64, error)
	Sale(account string, ticker string, count uint64) (float64, error)
}

// GetOperator 获取证券客户端操作接口
func GetOperator(clientType string) Operator {
	switch clientType {
	case "htwt":
		return &htwt.BaseOperator{}
		// operator = &htwt.TestOperator{}
	case "cjzq":
		return &cjzq.BaseOperator{}
	default:
		panic("unknown clientType")
	}
}
